<?php
/**
 * 页眉
 */

class Header extends CWidget {
    public function run() {

        $cache_key = 'f_menu';
        if (Yii::app()->cache->get($cache_key)) {
            $menus_item = Yii::app()->cache->get($cache_key);
        } else {
            $menus_item_one = array(
                array('label' => '网站首页', 'url' => array('/site/index')),
            );
            $node = new Node();
            $menus_item_two = $node->getCMenuItemsData();
            if (count($menus_item_two)) {
                $menus_item = CMap::mergeArray($menus_item_one, $menus_item_two);
            } else {
                $menus_item = $menus_item_one;
            }
            Yii::app()->cache->set($cache_key, $menus_item, 60 * 5);
        }

        
        $this->render('Header', array('menus_item' => $menus_item));
    }
}
